const {createProxyMiddleware}=require("http-proxy-middleware");

module.exports=function(app){
    //使用中间件
    app.use(createProxyMiddleware("/zhihu",{
        target:"https://news-at.zhihu.com",//跨域的网址
        changeOrigin:true,//伪装访问的源
        pathRewrite:{//重写接口路由
            "/zhihu":""
        }
    }))

    app.use(createProxyMiddleware("/jianshu",{
        target:"https://www.jianshu.com",
        changeOrigin:true,
        pathRewrite:{
            "/jianshu":""
        }
    }))

}